home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2c.lha / p4-1.2c / lib / p4_MD.h < prev    next >
C/C++ Source or Header  |  1993-06-21  |  10KB  |  469 lines

  1.  
  2. /* ------------------ Machine Dependent Definitions ---------------- */
  3. /*
  4.         It is important to maintain the order of many of the 
  5.         definitions in this file.
  6. */
  7.  
  8.  
  9. #if defined(SP1)
  10. #define RS6000
  11. #undef P4_MACHINE_TYPE
  12. #define P4_MACHINE_TYPE "RS6000"
  13. #endif
  14.  
  15. #if defined(PARAGON)
  16. #define IPSC860
  17. #undef P4_MACHINE_TYPE
  18. #define P4_MACHINE_TYPE "IPSC860"
  19. #endif
  20.  
  21. #if defined(CONVEX)
  22. #define SUN
  23. #undef P4_MACHINE_TYPE
  24. #define P4_MACHINE_TYPE "SUN"
  25. #endif
  26.  
  27. #if defined(TC_2000_TCMP)
  28. #define TC_2000
  29. #define TCMP
  30. #endif
  31.  
  32. #if defined(FX8)  ||  defined(FX2800)  || defined(FX2800_SWITCH)
  33. #define ALLIANT
  34. #endif
  35.  
  36. #if defined(FX2800)  || defined(FX2800_SWITCH)
  37. #define VPRINTF
  38. #endif
  39.  
  40. #if defined(DELTA) || defined(IPSC860_SOCKETS) || defined(PARAGON)
  41. #define IPSC860
  42. #endif
  43.  
  44. #if defined(CM5_SOCKETS)
  45. #define CM5
  46. #endif
  47.  
  48. #if defined(NCUBE_SOCKETS)
  49. #define NCUBE
  50. #endif
  51.  
  52. #if defined(NEXT)  || defined(KSR) ||  defined(IPSC860)  || defined(NCUBE)
  53. #define GLOBAL
  54. #endif
  55.  
  56.  
  57. #if defined(SUN)        || defined(DEC5000)  || \
  58.     defined(NEXT)       || defined(KSR)      || \
  59.     defined(SYMMETRY)   || defined(BALANCE)  || \
  60.     defined(ALLIANT)    || defined(MULTIMAX) ||  defined(CM5) || \
  61.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  62.  
  63. #define P4BSD
  64.  
  65. #endif
  66.  
  67. #if defined(SUN)        || defined(DEC5000)  || \
  68.     defined(NEXT)       || defined(KSR)      || \
  69.     defined(SYMMETRY)   || defined(BALANCE)  || \
  70.     defined(ALLIANT)    || defined(MULTIMAX) || \
  71.     defined(GP_1000)    || defined(TC_2000)  ||  defined(IBM3090)
  72.  
  73. #define CAN_DO_SETSOCKOPT
  74.  
  75. #endif
  76.  
  77. #if defined(RS6000)          ||                          \
  78.     defined(IPSC860_SOCKETS) ||                          \
  79.     defined(NCUBE_SOCKETS)   ||                          \
  80.     defined(DELTA)           || defined(TITAN)        || \
  81.     defined(SGI)             || defined(CRAY)         || \
  82.     defined(HP)              || defined(SYMMETRY_PTX)
  83.  
  84. #define CAN_DO_SETSOCKOPT
  85.  
  86. #endif
  87.  
  88.  
  89. #if defined(RS6000)       || \
  90.     defined(IPSC860)      ||                          \
  91.     defined(NCUBE)        ||                          \
  92.     defined(DELTA)        || defined(TITAN)        || \
  93.     defined(SGI)          || defined(CRAY)         || \
  94.     defined(HP)           || defined(SYMMETRY_PTX)
  95.  
  96. #define P4SYSV
  97.  
  98. #endif
  99.  
  100.  
  101. #ifdef P4SYSV
  102. #   ifdef NCUBE
  103. #   define SIGNAL_P4 signal
  104. #   else
  105. #   define SIGNAL_P4 sigset
  106. #   endif
  107. #else
  108. #define SIGNAL_P4 signal
  109. #endif
  110.  
  111.  
  112. #ifndef P4BOOL
  113. #define P4BOOL int
  114. #endif
  115.  
  116. #if defined(BALANCE)  ||  defined(FX8)
  117. #define P4VOID int
  118. #else 
  119. #define P4VOID void
  120. #endif
  121.  
  122.  
  123. /*------------------ Encore Multimax ---------------------- */
  124.  
  125.  
  126. #if defined(MULTIMAX)
  127.  
  128. #include <parallel.h>
  129.  
  130. #ifndef LINT
  131. typedef LOCK *MD_lock_t;
  132. #define MD_lock_init(l)  *(l) = spin_create(PAR_UNLOCKED);
  133. #define MD_lock(l)       spin_lock(*(l));
  134. #define MD_unlock(l)     spin_unlock(*(l));
  135. #endif
  136.  
  137. #define GLOBMEMSIZE  (2*1024*1024)
  138. #define CAN_DO_SOCKET_MSGS
  139. #define CAN_DO_XDR
  140. #define CAN_DO_SHMEM_MSGS
  141. #define P4_MAX_MSG_QUEUES 64
  142.  
  143. #endif
  144.  
  145.  
  146. /*------------------ Sequent Balance or Symmetry ---------------------- */
  147.  
  148.  
  149. #if !defined(SYMMETRY) && !defined(SYMMETRY_PTX) && !defined(BALANCE)
  150. #define CAN_HANDLE_SIGSEGV
  151. #endif
  152.  
  153. #if defined(BALANCE) || defined(SYMMETRY) || defined(SYMMETRY_PTX)
  154.  
  155. #include <parallel/parallel.h>
  156.  
  157. typedef slock_t MD_lock_t;
  158.  
  159. #ifndef LINT
  160. #define MD_lock_init(l)  s_init_lock(l);
  161. #define MD_lock(l)       s_lock(l);
  162. #define MD_unlock(l)     s_unlock(l);
  163. #endif
  164. extern char *shmalloc();
  165. #if defined(SYMMETRY_PTX)
  166. extern P4VOID *malloc();
  167. #else
  168. extern char *malloc();
  169. #endif
  170.  
  171. #define GLOBMEMSIZE  (1*1024*1024)
  172. #define CAN_DO_SOCKET_MSGS
  173. #define CAN_DO_XDR
  174. #define CAN_DO_SHMEM_MSGS
  175. #define P4_MAX_MSG_QUEUES 64
  176.  
  177. #endif
  178.  
  179. /*---------------------------- Alliant -------------------------------- */
  180. #if defined(ALLIANT)
  181.  
  182. typedef char MD_lock_t;
  183.  
  184. #ifndef LINT
  185. #define MD_lock_init(l)  initialize_lock(l);
  186. #define MD_lock(l)       lock(l);
  187. #define MD_unlock(l)     unlock(l);
  188. #endif
  189. extern char *valloc();
  190.  
  191. #define GLOBMEMSIZE  (2*1024*1024)
  192.  
  193. #define USE_XX_SHMALLOC          /* If not defined uses dumb xx_malloc */
  194.  
  195. #define CAN_DO_SOCKET_MSGS
  196. #define CAN_DO_XDR
  197. #define CAN_DO_SHMEM_MSGS
  198. #define P4_MAX_MSG_QUEUES 64
  199.  
  200. #endif
  201.  
  202. #if defined(FX2800_SWITCH)
  203. #include "sw.h"
  204. #define CAN_DO_SWITCH_MSGS
  205. #endif
  206.  
  207.  
  208. /*---------------------------- Uniprocessors -------------------------- */
  209.  
  210. #if defined(CRAY) || defined(NEXT)
  211. #define GLOBMEMSIZE  (1*1024*1024)
  212. #define CAN_DO_SOCKET_MSGS
  213. #define CAN_DO_XDR
  214. #define P4_MAX_MSG_QUEUES 1
  215. typedef int MD_lock_t;
  216. #define MD_lock_init(l)
  217. #define MD_lock(l)
  218. #define MD_unlock(l)
  219. #endif
  220.  
  221. #if defined(SUN) ||  defined(DEC5000)      \
  222.     || defined(RS6000) || defined(IBM3090) \
  223.     || defined(TITAN) || defined(SGI)      \
  224.     || defined(HP)
  225.  
  226. #define P4_SYSV_SHM_SEGSIZE (1*1024*1024)
  227.  
  228. #if defined(SYSV_IPC)
  229. #define GLOBMEMSIZE  (1*1024*1024)
  230. #define CAN_DO_SOCKET_MSGS
  231. #define CAN_DO_XDR
  232. #define CAN_DO_SHMEM_MSGS
  233. #define USE_XX_SHMALLOC
  234. #define P4_MAX_MSG_QUEUES 4
  235. #define P4_MAX_SYSV_SHMIDS  8
  236. #define P4_MAX_SYSV_SEMIDS  8
  237.  
  238. typedef struct { int semid;  int semnum; }   MD_lock_t;
  239.  
  240. #include <sys/ipc.h>
  241. #include <sys/shm.h>
  242. #include <sys/sem.h>
  243.  
  244. static struct sembuf sem_lock[1] = {
  245.     0, -1, 0
  246. };
  247. static struct sembuf sem_unlock[1] = {
  248.     0, 1, 0
  249. };
  250.  
  251. #else
  252.  
  253. #define GLOBMEMSIZE  (1*1024*1024)
  254. #define CAN_DO_SOCKET_MSGS
  255. #define CAN_DO_XDR
  256. #define P4_MAX_MSG_QUEUES 1
  257. typedef int MD_lock_t;
  258. #define MD_lock_init(l)
  259. #define MD_lock(l)
  260. #define MD_unlock(l)
  261.  
  262. #endif
  263. #endif
  264.  
  265.  
  266. /* following is for POSIX std versions of Unix */
  267. #if defined(SGI)  ||  defined(RS6000)  ||  defined(HP)
  268. #include <unistd.h>
  269. #endif
  270.  
  271. /* Peter Krauss suggested this change (POSIX ??) */
  272. #if defined(HP)
  273. #define        getdtablesize()        sysconf(_SC_OPEN_MAX)
  274. #endif
  275.  
  276.  
  277.  
  278. /*---------------------------- IPSC860 Cube --------------------------- */
  279.  
  280. #if defined(IPSC860)
  281.  
  282. #    if defined(DELTA)
  283. #        define P4_MAX_CUBE_MSGS_OUT 5
  284. #    else
  285. #        define P4_MAX_CUBE_MSGS_OUT 5
  286. #    endif
  287.  
  288. #define MD_cube_send  MD_i860_send
  289. #define MD_cube_recv  MD_i860_recv
  290. #define MD_cube_msgs_available  MD_i860_msgs_available
  291.  
  292. typedef int MD_lock_t;
  293.  
  294. #if defined(IPSC860)
  295. #define MYNODE mynode
  296. #endif
  297.  
  298. #ifndef LINT
  299. #define MD_lock_init(l)
  300. #define MD_lock(l)
  301. #define MD_unlock(l)
  302. #endif
  303.  
  304. #define GLOBMEMSIZE  (1*1024*1024)
  305. #define CAN_DO_CUBE_MSGS
  306. #define P4_MAX_MSG_QUEUES 1
  307.  
  308. #define ALL_NODES -1
  309.  
  310. #define NO_TYPE_IPSC     0 
  311. #define ACK_REQUEST_IPSC 1
  312. #define ACK_REPLY_IPSC   2
  313. #define ANY_P4TYPE_IPSC    0x80000007
  314.  
  315. #define NODE_PID 0
  316.  
  317. #if defined(IPSC860_SOCKETS)
  318. #define CAN_DO_SOCKET_MSGS
  319. /*****
  320. #include <CMC/sys/types.h>
  321. #include <CMC/sys/socket.h>
  322. #include <CMC/netinet/in.h>
  323. #include <CMC/netdb.h>
  324. *****/
  325. #include <CMC/ntoh.h>
  326. #endif
  327.  
  328. #endif    
  329.  
  330. /*---------------------------- CM-5 --------------------------- */
  331.  
  332. #if defined(CM5)
  333.  
  334. #include <cm/cmmd.h>
  335. /* #include <cm/cmmd-io.h> */
  336.  
  337. typedef int MD_lock_t;
  338.  
  339. #if defined(CM5)
  340. #define MYNODE CMMD_self_address
  341. #endif
  342.  
  343. #ifndef LINT
  344. #define MD_lock_init(l)
  345. #define MD_lock(l)
  346. #define MD_unlock(l)
  347. #endif
  348.  
  349. #define GLOBMEMSIZE  (1*1024*1024)
  350. #define CAN_DO_CUBE_MSGS
  351. #define P4_MAX_MSG_QUEUES 1
  352.  
  353. #define NO_TYPE_CM5     0 
  354. #define ACK_REQUEST_CM5 1
  355. #define ACK_REPLY_CM5   2
  356. #define ANY_P4TYPE_CM5    CMMD_ANY_TAG
  357.  
  358. #define MD_cube_send  MD_CM5_send
  359. #define MD_cube_recv  MD_CM5_recv
  360. #define MD_cube_msgs_available  MD_CM5_msgs_available
  361.  
  362. #endif    
  363.  
  364.  
  365. /*---------------------------- NCUBE --------------------------- */
  366.  
  367. #if defined(NCUBE)
  368.  
  369. typedef int MD_lock_t;
  370.  
  371. #include <sysn.h> 
  372.  
  373. #define MYNODE npid
  374.  
  375. #ifndef LINT
  376. #define MD_lock_init(l)
  377. #define MD_lock(l)
  378. #define MD_unlock(l)
  379. #endif
  380.  
  381. #define GLOBMEMSIZE  (1*1024*1024)
  382. #define CAN_DO_CUBE_MSGS
  383. #define P4_MAX_MSG_QUEUES 1
  384.  
  385. #define NO_TYPE_NCUBE     0 
  386. #define ACK_REQUEST_NCUBE 1
  387. #define ACK_REPLY_NCUBE   2
  388. #define ANY_P4TYPE_NCUBE  (-1)
  389.  
  390. #define NCUBE_ANY_NODE  (-1)
  391. #define NCUBE_ANY_TAG   (-1)
  392.  
  393. #define MD_cube_send  MD_NCUBE_send
  394. #define MD_cube_recv  MD_NCUBE_recv
  395. #define MD_cube_msgs_available  MD_NCUBE_msgs_available
  396.  
  397. #endif    
  398.  
  399. /*----------------   KSR             -------------------------*/
  400. #if defined(KSR)
  401. #include <sys/mman.h>
  402. #include <pthread.h>
  403.  
  404. #define USE_XX_SHMALLOC
  405. #define GLOBMEMSIZE  (8*1024*1024)
  406. #define P4_MAX_MSG_QUEUES 32
  407. #define CAN_DO_SOCKET_MSGS
  408. #define CAN_DO_XDR
  409. #define CAN_DO_SHMEM_MSGS
  410.  
  411. #define MD_lock_t       msemaphore
  412. #define MD_lock_init(l) msem_init(l, MSEM_UNLOCKED)
  413. #define MD_lock(l)      msem_lock(l, 0)
  414. #define MD_unlock(l )   msem_unlock(l, 0)
  415.  
  416. #endif
  417.  
  418.  
  419.  
  420. /*------------------ Butterfly TC-2000/GP-1000 -------------- */
  421. #if defined(TC_2000)  ||  defined(GP_1000)
  422. #include <mach.h>    
  423. #include <sys/cluster.h>
  424. #include <sys/kern_return.h>
  425. #include <heap.h>
  426.  
  427. char *xx_malloc();
  428. P4VOID MD_malloc_hint();
  429.  
  430. #ifdef MALLOC_STATS
  431. static unsigned int allocated = 0;
  432. #endif
  433.  
  434. #define MD_lock_t       int
  435. #ifndef LINT
  436. #define MD_lock_init(l) simple_unlock(l)
  437. #define MD_lock(l)      simple_lock(l)
  438. #define MD_unlock(l)    simple_unlock(l)
  439. #endif
  440.  
  441. #define GLOBMEMSIZE  (1*1024*1024)
  442. #define CAN_DO_SOCKET_MSGS
  443. #define CAN_DO_XDR
  444. #define CAN_DO_SHMEM_MSGS
  445. #define P4_MAX_MSG_QUEUES 128
  446.  
  447. #endif
  448.  
  449. #ifdef TCMP
  450. #define CAN_DO_TCMP_MSGS
  451. /* #include </Net/sparky/sparky1/lusk/lepido/tcmp/tcmp.h> */
  452. #include </usr/bbnm/tcmp/tcmp.h>
  453. #endif
  454.  
  455. /* ----------------- Can be made machine dependent -------------------*/
  456.  
  457. typedef unsigned long p4_usc_time_t;
  458.  
  459.  
  460. extern P4VOID exit();
  461.  
  462. #define P4_MAXPROCS 128
  463.  
  464. #ifndef LINT
  465. #define p4_malloc malloc
  466. #define p4_free free
  467. #define p4_clock MD_clock
  468. #endif
  469.